Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

everyday-types

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

everyday-types

Everyday utility types

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
39
increased by25.81%
Maintainers
1
Weekly downloads
 
Created
Source

everyday-types

Everyday utility types

npm i everyday-types pnpm add everyday-types yarn add everyday-types

API

# AAt src/string.ts#L3

    A extends List ? number extends A ["length"] ? K extends number | template-literal ? A [never] | undefined : undefined : K extends keyof A ? A [K] : undefined : unknown extends A ? unknown : K extends keyof A ? A [K] : undefined

# Cast src/string.ts#L42
# Key src/string.ts#L1

    string | number | symbol

# LLength – Ask TS to re-check that A1 extends A2. And if it fails, A2 will be enforced anyway. Can also be used to add constraints on parameters. src/string.ts#L40

    L ["length"]

# List src/string.ts#L2

    ReadonlyArray<A>

# Literal src/string.ts#L11

    string | number | bigint | boolean

# Pop src/string.ts#L63

    L extends readonly [ rest, any ] | readonly [ rest, optional ] ? LBody : L

# _Replace src/string.ts#L47

    S extends template-literal ? Replace<template-literal, R, W> : S

# __Split src/string.ts#L50

    S extends template-literal ? __Split<AS, D, [ rest, BS ]> : [ rest, S ]

# String src/string.ts#L1
# CustomElement src/everyday-types.ts#L83

    # attributeChangedCallback(name, oldValue, newValue) – Callback that is invoked when one of the {@link withProperties} changes.

      # name – Name of attribute

        string

      # oldValue – Old value

        null | string

      # newValue – New value

        null | string

      attributeChangedCallback(name, oldValue, newValue)  =>

      # connectedCallback() – Invoked when the component is added to the document's DOM.

        In connectedCallback() you should setup tasks that should only occur when the element is connected to the document. The most common of these is adding event listeners to nodes external to the element, like a keydown event handler added to the window.

        connectedCallback() {
          super.connectedCallback();
          this.addEventListener('keydown', this._handleKeydown);
        }
        

        Typically, anything done in connectedCallback() should be undone when the element is disconnected, in disconnectedCallback().

        connectedCallback()  =>

        # disconnectedCallback() – Invoked when the component is removed from the document's DOM.

          This callback is the main signal to the element that it may no longer be used. disconnectedCallback() should ensure that nothing is holding a reference to the element (such as event listeners added to nodes external to the element), so that it is free to be garbage collected.

          disconnectedCallback() {
            super.disconnectedCallback();
            window.removeEventListener('keydown', this._handleKeydown);
          }
          

          An element may be re-connected after being disconnected.

          disconnectedCallback()  =>

        # EventHandler src/everyday-types.ts#L7
        # SafeMap src/everyday-types.ts#L62

          # get(v)

            # v

            get(v)  =>

          # has(v)

            # v

            has(v)  =>

          # SafeWeakMap src/everyday-types.ts#L67

            # get(v)

              # v

              get(v)  =>

            # has(v)

              # v

              has(v)  =>

            # Any src/everyday-types.ts#L60

              any

            # Chunk src/everyday-types.ts#L3

              N extends N ? number extends N ? T [] : _Chunk<T, N, [ ]> : never

            # Class src/everyday-types.ts#L5
            # Ctor src/everyday-types.ts#L6
            # CustomElementConstructor src/everyday-types.ts#L74
            # DetailOf src/everyday-types.ts#L54
            # EventKeys src/everyday-types.ts#L10
            # EventsOf src/everyday-types.ts#L33
            # Fn src/everyday-types.ts#L11

              # (args)

                # args

                (args)  =>

            # Get src/everyday-types.ts#L12
            # Key src/everyday-types.ts#L13

              number | string | symbol

            # Keys src/everyday-types.ts#L14
            # Mixable src/everyday-types.ts#L15

              {} & Omit<T, "constructor">

            # Mutable src/everyday-types.ts#L16

              [P in keyof T ]: T [P]

            # Narrow src/everyday-types.ts#L18

              K extends T ? K : never

            # NarrowKey src/everyday-types.ts#L17
            # NonNull src/everyday-types.ts#L19
            # Null src/everyday-types.ts#L20

              null | undefined | void

            # ObjectFromList src/everyday-types.ts#L22

              [K in T extends ReadonlyArray<inferred> ? U : never ]: V

            # Prefix src/everyday-types.ts#L25

              template-literal

            # SansOn src/everyday-types.ts#L26
            # StringKeys src/everyday-types.ts#L27
            # StringLiteral src/everyday-types.ts#L28

              T extends string ? string extends T ? never : T : never

            # StringOf src/everyday-types.ts#L29
            # Target src/everyday-types.ts#L30

              HTMLElement | SVGElement | Window | Document | ShadowRoot

            # ValueConstructor src/everyday-types.ts#L72

              StringConstructor | NumberConstructor | BooleanConstructor

            # ValuesOf src/everyday-types.ts#L31

              T [keyof T]

            # _Chunk src/everyday-types.ts#L4

            Credits

            Contributing

            Fork or edit and submit a PR.

            All contributions are welcome!

            License

            MIT © 2022 stagas

            FAQs

            Package last updated on 07 Aug 2022

            Did you know?

            Socket

            Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

            Install

            Related posts

            SocketSocket SOC 2 Logo

            Product

            • Package Alerts
            • Integrations
            • Docs
            • Pricing
            • FAQ
            • Roadmap
            • Changelog

            Packages

            npm

            Stay in touch

            Get open source security insights delivered straight into your inbox.


            • Terms
            • Privacy
            • Security

            Made with ⚡️ by Socket Inc